import type { GDVSceneConfig, Scene } from '#/views/scenes/index';

import { defineStore } from 'pinia';

export const useSceneStore = defineStore('scene', {
  state: () => {
    return {
      editingScene: {
        sceneId: '',
        sceneName: 'untitled',
        sceneType: '',
        sceneImg: '',
        userId: '',
        editCount: 0,
        createdTime: '',
        lastUpdatedTime: '',
        isLocked: false,
        permissionRange: 16,
        // dataSet: [],
        // toolSet: []
      } as Scene,
      currentSceneConfig: {} as GDVSceneConfig,
      currentTableFile: {} as any,
    };
  },
  actions: {
    setEditingScene(scene: Scene) {
      this.editingScene = scene;
    },
    setCurrentSceneConfig(sceneConfig: GDVSceneConfig) {
      this.currentSceneConfig = sceneConfig;
    },
    // updateCurrentSceneConfigLayerGroup(layer: any) {
    //   this.currentSceneConfig.layerGroup.forEach((layer: any) => {});
    // },
    setCurrentTableFile(data: any) {
      this.currentTableFile = data; // 存储完整的 data 对象
    },
  },
});
